Open
Conversation
Collaborator
Author
|
@claude code review |
Raise ClientError/ServerError for Sandbox HTTP JSON error responses and expose structured error metadata on HTTPError. Document the breaking migration in release notes. Tests: uv run pytest tests/unittests/utils/test_exception.py tests/unittests/sandbox/api/test_sandbox_data.py; uv run pytest tests/unittests/sandbox/api/test_code_interpreter_data.py tests/unittests/sandbox/api/test_browser_data.py tests/unittests/sandbox/api/test_aio_data.py tests/unittests/sandbox/test_client.py. Type check: targeted mypy passed for modified files. Full mypy is blocked by existing duplicate module sandbox from local/sandbox/__init__.py and examples/sandbox.py. Signed-off-by: 寒光 <2510399607@qq.com>
656de29 to
1f291b5
Compare
…le isolation - Added an `autouse` fixture to automatically clean up environment variables related to the SDK configuration. - Prevents local `.env` files from interfering with the environment variable settings used in unit tests. - Cleans up specific environment variables to prevent assertion failures within `respx` mocks. - Ensures environment variable isolation between test cases, thereby enhancing test stability. - Cleans up only those environment variables that the SDK reads by default, without affecting user-defined variables. Signed-off-by: 寒光 <2510399607@qq.com>
1bdea68 to
887c087
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Standardizes Sandbox data-plane HTTP JSON API error handling so callers receive consistent ClientError/ServerError exceptions (with structured metadata) instead of needing to inspect returned dictionaries.
Changes:
- Extend
HTTPErrorto carryerror_code,response_body, andresponse_headers, and update string formatting to avoid expanding response metadata. - Update
SandboxDataAPIHTTP handling to raiseClientErrorfor4xxandServerErrorfor5xxJSON error responses (sync + async), with robust request-id extraction. - Add unit tests for the new exception fields/formatting and Sandbox data-plane HTTP behaviors; add release notes documenting the breaking migration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unittests/utils/test_exception.py | Adds coverage for new HTTPError metadata fields and updated __str__ behavior. |
| tests/unittests/sandbox/api/test_sandbox_data.py | Adds respx-based tests validating sandbox data-plane success/error behaviors for sync/async calls. |
| tests/unittests/conftest.py | Adds autouse env isolation to prevent local .env from polluting unit tests. |
| agentrun/utils/exception.py | Adds structured error metadata to HTTPError and updates formatting; simplifies ClientError/ServerError. |
| agentrun/sandbox/api/sandbox_data.py | Implements standardized HTTP JSON error raising and structured error extraction for Sandbox data-plane requests. |
| agentrun/sandbox/api/__sandbox_data_async_template.py | Updates codegen template to match the new sandbox data-plane HTTP error handling behavior. |
| RELEASE_NOTES.md | Documents the breaking behavior change and migration guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@copilot 检查下是否存在隐患,是否存在不兼容变动 |
Contributor
以下是变更中存在的隐患及不兼容点分析: 已记录的 Breaking Change(在 RELEASE_NOTES.md 中有说明)
未记录的 Breaking Change
潜在风险(功能不一致)
向后兼容改动(无风险)
建议:在 RELEASE_NOTES.md 中补充 |
…mat change Agent-Logs-Url: https://github.com/Serverless-Devs/agentrun-sdk-python/sessions/521d41f7-af5d-44a2-9ba2-b04863849851 Co-authored-by: OhYee <13498329+OhYee@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raise ClientError/ServerError for Sandbox HTTP JSON error responses and expose structured error metadata on HTTPError. Document the breaking migration in release notes.
Tests: uv run pytest tests/unittests/utils/test_exception.py tests/unittests/sandbox/api/test_sandbox_data.py; uv run pytest tests/unittests/sandbox/api/test_code_interpreter_data.py tests/unittests/sandbox/api/test_browser_data.py tests/unittests/sandbox/api/test_aio_data.py tests/unittests/sandbox/test_client.py.
Type check: targeted mypy passed for modified files. Full mypy is blocked by existing duplicate module sandbox from local/sandbox/init.py and examples/sandbox.py.
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update